<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ include file="../common/tags.jsp"%>  
<%
	String path = request.getContextPath();
%>
<html><head>
<script>
	function submitSelectForm(form){
		//if('${templateId}' == '')
			//return navTabSearch(form);
			//customerShopListTab.loadUrl(form.action, $(form).serializeArray());
    		//return false;
    		//customerEditShopListTab  对应要刷新的div
    		return divSearch(form,'customerEditShopListTab');
			
	   /// else
	   		//return tabSearch(form);
	   		 //alert(navTab._getTabs().filter('.selected').attr('tabid').loadUrl(form.action, $(form).serializeArray()));
	   		 //return false;
	   		 //.loadUrl(form.action, $(form).serializeArray());
	   		 //return false;
	    	//return dwzSearch(form, 'dialog');
	}

</script></head><body>
<div id="customerEditShopListTab">
<form id="pagerForm" method="post" action="<%=path %>/shop/listShop.action?templateId=${templateId}&customerId=${shopVO.customer.id}">
	<input type="hidden" name="pageRequest" value="1" />
	<input type="hidden" name="pageNum" value="${paginator.pageIndex}" />
	<input type="hidden" name="numPerPage" value="${paginator.pageSize}" />
</form>

<div class="pageHeader">
	<form onsubmit="return submitSelectForm(this);" rel="pagerForm" action="<%=path %>/shop/listShop.action?templateId=${templateId}&customerId=${shopVO.customer.id}" method="post">
	<div class="searchBar">
		<ul class="searchContent">
			<li>
				<label>店面名称：</label>
				<input name="shopVO.name" value="<s:property value="shopVO.name"/>" type="text" size="20"/>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
				<c:if test="${templateId == -2}">
					<li><div class="button"><div class="buttonContent"><button type="button" multLookup="ids" warn="请选择店面">选择带回</button></div></div></li>
				</c:if>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
	 <c:if test="${templateId == null}">
		<ul class="toolBar">
			<shiro:hasPermission name="addShop">
			<li><a class="add" href="<%=path %>/shop/addShop.action?customerId=${shopVO.customer.id}" target="dialog"><span>添加店面</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="deleteShop">
			<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="ids" postType="string" href="<%=path %>/shop/deleteShop.action" class="delete"><span>删除</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="editShop">
			<li><a class="edit" href="<%=path %>/shop/editShop.action?shopVO.id={sid_user}" target="dialog" warn="请选择一条记录" mask="true"><span>修改</span></a></li>
			</shiro:hasPermission>
		</ul>
		</c:if>
	</div>
	<table class="table" width="100%" layoutH="172">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th>店面名称</th>
				<th>店面编码</th>
				<th>地址</th>
				<th>联系人</th>
				<th>联系电话</th>
				<th>所属商户</th>
				<th>坐标</th>
				<th width="70">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="shopList" id="shop" status="st">
				<tr target="sid_user" rel="<s:property value="id" />">
				<td>
					<c:choose>
		             	<c:when test="${templateId  == -2}">
		             		<input name="ids" ${fn:contains(shops,shop.id) ? 'checked=checked' : ''} value="{shopCode:'${shop.id}', shopNames:'${shop.name}'}" type="checkbox">
						</c:when>  
   						 <c:otherwise>
							<input name="ids" value="<s:property value="id" />" type="checkbox">
						</c:otherwise>  
					</c:choose>  
				</td>
             <td><s:property value="name" /></td>	
             <td><s:property value="code" /></td>	
             <td><s:property value="address" /></td>	
             <td><s:property value="contact" /></td>	
             <td><s:property value="phone" /></td>	
             <td><s:property value="customer.name" /></td>
             <td><s:property value="lng" />，<s:property value="lat" /></td>
					<td>
						<shiro:hasPermission name="deleteShop">
						<a title="确实要删除这条记录吗?" target="ajaxTodo" href="<%=path %>/shop/deleteShop.action?ids=<s:property value="id" />" class="btnDel">删除</a>
						</shiro:hasPermission>
						<shiro:hasPermission name="editShop">
						<a title="编辑" target="dialog" href="<%=path %>/shop/editShop.action?shopVO.id=<s:property value="id" />" class="btnEdit">编辑</a>
						</shiro:hasPermission>
					</td>
					
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
				<span>显示</span>
				<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'customerEditShopListTab')">
					<option value="15" <c:if test="${paginator.pageSize==15}">selected='selected'</c:if> >15</option>
					<option value="30" <c:if test="${paginator.pageSize==30}">selected='selected'</c:if> >30</option>
					<option value="50" <c:if test="${paginator.pageSize==50}">selected='selected'</c:if> >50</option>
					<option value="100" <c:if test="${paginator.pageSize==100}">selected='selected'</c:if> >100</option>
					<option value="200" <c:if test="${paginator.pageSize==200}">selected='selected'</c:if> >200</option>
				</select>
				<span>条，共${paginator.totalCount}条</span>
			</div>
			<div class="pagination" rel="customerEditShopListTab" totalCount="${paginator.totalCount}" 
				numPerPage="${paginator.pageSize}" pageNumShown="10" currentPage="${paginator.pageIndex}"></div>
	</div>
</div>
</div>
</body></html>